<?php
    // Create order table

    $DB = mysqli_connect('kvd_mysql', 'root', 'root', 'kvd');
    try {
        $sql = "create table if not exists  orders (
            id int PRIMARY KEY AUTO_INCREMENT,
            user_id int,
            event_id int,
            status int,
            token VARCHAR(255),
            created VARCHAR(255),
            updated VARCHAR(255),
            FOREIGN KEY (user_id) REFERENCES kvd.users (id),
            FOREIGN KEY (event_id) REFERENCES kvd.events (id)
        );";
        $DB->query($sql);
    } catch (Exception $exception) {
        echo $exception;
    }
    $DB->close();
    unset($DB);
